package com.gxar.quick.ar.server.base.async.works.listener;

import com.gxar.quick.ar.server.base.async.works.event.UploadIdentifyEvent;
import com.gxar.quick.ar.server.db.service.ExchangeItemService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author linsy
 * @version 1.0
 * @created 2024/4/10 15:52
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class UploadIdentifyListener implements ApplicationListener<UploadIdentifyEvent> {

    private final ExchangeItemService exchangeItemService;

    @Async
    @Override
    public void onApplicationEvent(UploadIdentifyEvent event) {
        exchangeItemService.exchangeItemUploadIdentify(event.getType(), event.getUserId(), event.getWorksId(), event.getImage());
    }

}
